<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="jquery.min.js"></script>
</head>
<body>

	<input type="button" value="通过ajax获取一个category对象" id="sender">
	<div id="messageDiv"></div>
	
	<script type="text/javascript">
		$('#sender').click(function(){
			var url="getOneCategory";
			$.post(
					
				url,
				function(data){
					var json=JSON.parse(data);
					var name=json.category.name;
					var id=json.category.id;
					$('#messageDiv').html("分类id：" + id + "<br>分类名称：" + name);
				});
		});
	</script>
</body>
</html>